Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button: Creating ActionButton variant and cleaning styling #8645

Merged
merged 4 commits into from
Apr 10, 2019

Conversation

khmakoto
Copy link
Member

@khmakoto khmakoto commented Apr 8, 2019

Pull request checklist

  • Addresses an existing issue: Fixes #0000
  • Include a change request file using $ npm run change

Description of changes

This PR adds an ActionButton variant to improve parity between new and old Button components while also making some styling fixes in general.

Below is a comparison, on the left using the ActionButtons in office-ui-fabric-react and on the right using the ones in experiments:

image

Focus areas to test

(optional)

Microsoft Reviewers: Open in CodeFlow

@size-auditor
Copy link

size-auditor bot commented Apr 8, 2019

Size Auditor did not detect a change in bundle size for any component!


export interface IButtonVariantProps extends IButtonProps {
iconProps?: IIconProps;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should consider marking this prop as deprecated in master and then remove it for Fabric 7 release, which would mean we wouldn't need to add it here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But how can we mark it as deprecated in the current Button in oufr if we still don't offer an alternative in that production component?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By adding a content prop.. should be relatively easy. Unless we don't think that's a good permanent name for Button content, in which case we have a larger problem to address.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then we do the same for iconProps? Deprecate it in favor of a new icon prop?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly. It's either that or we carry over duplicate names for props even in Fabric 7 which seems cumbersome to take on for all of 7.x. I wonder what @dzearing thinks.


return <Button primary content={text} {...rest} />;
return <Button primary content={text} icon={iconProps} {...rest} />;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the name that appears in the hierarchy for these variants? If it's Button then styling and theming targeting PrimaryButton by name won't work. If both Button and PrimaryButton are appearing in hierarchy, then I think styling and theming will be even more wonky.

All of this is just driving need for an extendComponent utility that will just have one entry called PrimaryButton in the hierarchy that should still take directed styling and theming. This is covered by #8331 (and it seems should be resolved before Fabric 7 release.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think only Button appears in the hierarchy right now.

Copy link
Member

@JasonGore JasonGore Apr 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other button variants appear as Unknown. We could apply displayName to them but that won't fix the styling issue since there is no helper like styled reading the setting and applying it (the variants are just thin wrappers.)

I'll add a note to #8331. The only other solution I can think of is to create new variants using styled or createComponent.

@@ -3,7 +3,7 @@ import { Button } from './Button';
import { ButtonVariantsType } from './ButtonVariants.types';

export const DefaultButton: ButtonVariantsType = props => {
const { text, ...rest } = props;
const { text, iconProps, ...rest } = props;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't catch this in the other PR but maybe text is another prop that could be deprecated in master and removed in Fabric 7.

@msft-github-bot
Copy link
Contributor

Hello @kkjeer!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me and give me an instruction to get started! Learn more here.

@kkjeer
Copy link
Contributor

kkjeer commented Apr 9, 2019

@msft-github-bot require approval from @JasonGore and @dzearing

@msft-github-bot
Copy link
Contributor

Hello @kkjeer!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@khmakoto
Copy link
Member Author

khmakoto commented Apr 9, 2019

@msft-github-bot forget everything

@msft-github-bot
Copy link
Contributor

Hello @khmakoto!

Because you've told me to reset the custom auto-merge settings, I'll use the configured settings for this repository when I'm merging this pull request.

@khmakoto
Copy link
Member Author

khmakoto commented Apr 9, 2019

@msft-github-bot require approval from @JasonGore

@msft-github-bot
Copy link
Contributor

Hello @khmakoto!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I'll only merge this pull request if it's approved by @JasonGore

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@micahgodbolt micahgodbolt mentioned this pull request Apr 9, 2019
37 tasks
Copy link
Member

@JasonGore JasonGore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving noting that styling and theming won't work until #8331 is resolved.

@msft-github-bot msft-github-bot merged commit 9834754 into microsoft:master Apr 10, 2019
@khmakoto khmakoto deleted the actionButton branch April 10, 2019 00:13
@msft-github-bot
Copy link
Contributor

🎉@uifabric/[email protected] has been released which incorporates this pull request.:tada:

Handy links:

@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants